package com.edu.study.base.lmsOrderReturnReason.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.edu.study.base.lmsOrderReturnReason.domain.LmsOrderReturnReason;
import com.edu.study.base.lmsOrderReturnReason.service.ILmsOrderReturnReasonService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * LmsOrderReturnReasonController
 * 
 * @author zw
 * @date 2021-08-11
 */
@RestController
@RequestMapping("/LmsOrderReturnReason/LmsOrderReturnReason")
public class LmsOrderReturnReasonController extends BaseController
{
    @Autowired
    private ILmsOrderReturnReasonService lmsOrderReturnReasonService;

    /**
     * 查询LmsOrderReturnReason列表
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderReturnReason:LmsOrderReturnReason:list')")
    @GetMapping("/list")
    public TableDataInfo list(LmsOrderReturnReason lmsOrderReturnReason)
    {
        startPage();
        List<LmsOrderReturnReason> list = lmsOrderReturnReasonService.selectLmsOrderReturnReasonList(lmsOrderReturnReason);
        return getDataTable(list);
    }

    /**
     * 导出LmsOrderReturnReason列表
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderReturnReason:LmsOrderReturnReason:export')")
    @Log(title = "LmsOrderReturnReason", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(LmsOrderReturnReason lmsOrderReturnReason)
    {
        List<LmsOrderReturnReason> list = lmsOrderReturnReasonService.selectLmsOrderReturnReasonList(lmsOrderReturnReason);
        ExcelUtil<LmsOrderReturnReason> util = new ExcelUtil<LmsOrderReturnReason>(LmsOrderReturnReason.class);
        return util.exportExcel(list, "LmsOrderReturnReason");
    }

    /**
     * 获取LmsOrderReturnReason详细信息
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderReturnReason:LmsOrderReturnReason:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(lmsOrderReturnReasonService.selectLmsOrderReturnReasonById(id));
    }

    /**
     * 新增LmsOrderReturnReason
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderReturnReason:LmsOrderReturnReason:add')")
    @Log(title = "LmsOrderReturnReason", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LmsOrderReturnReason lmsOrderReturnReason)
    {
        return toAjax(lmsOrderReturnReasonService.insertLmsOrderReturnReason(lmsOrderReturnReason));
    }

    /**
     * 修改LmsOrderReturnReason
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderReturnReason:LmsOrderReturnReason:edit')")
    @Log(title = "LmsOrderReturnReason", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LmsOrderReturnReason lmsOrderReturnReason)
    {
        return toAjax(lmsOrderReturnReasonService.updateLmsOrderReturnReason(lmsOrderReturnReason));
    }

    /**
     * 删除LmsOrderReturnReason
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderReturnReason:LmsOrderReturnReason:remove')")
    @Log(title = "LmsOrderReturnReason", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(lmsOrderReturnReasonService.deleteLmsOrderReturnReasonByIds(ids));
    }
}
